package com.situ.student.controller;

import java.util.List;

import com.situ.student.entity.Student;
import com.situ.student.exception.NameRepeatException;
import com.situ.student.service.IStudentService;
import com.situ.student.service.impl.StudentServiceImpl;

/**
 * Controller:控制层，
 * 1、获取界面上的数据
 * 2、将要实现的功能交给Service去处理
 * 3、为界面提供数据
 *
 */
public class StudentController {
	//private StudentServiceImpl studentService = new StudentServiceImpl();
	private IStudentService studentService = new StudentServiceImpl();
	
	public boolean register(String name, int age, String gender) throws NameRepeatException {
		Student student = new Student(name, age, gender);
		//return studentService.register(student);
		boolean reslut =studentService.register(student);
		return reslut;
	}

	public List<Student> findAll() {
		return studentService.findAll();
	}

}
